package com.example.livemall.controller;

import com.example.livemall.dto.LzjResult;
import com.example.livemall.dto.SearchResult;
import com.example.livemall.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 搜索服务控制层
 */
@RestController
@RequestMapping("/search")
public class SearchController {

    @Autowired
    private SearchService searchService;

    /**
     * 分页、高亮查询商品集合
     *
     * @param city
     * @param content
     * @param page
     * @param size
     * @return
     */
    @GetMapping("")
    public SearchResult selectItemForPage(String city, String content,
                                          int page, @RequestParam(defaultValue = "2") int size) {
        return searchService.selectItemForPage(city, content, page, size);
    }

}